package com.ruoyi.web.core.mybatis.util;

import cn.hutool.core.lang.Dict;
import cn.hutool.extra.template.TemplateUtil;

public class SimpleMybatisUtil {

    public static void main(String[] args) {
        System.out.println(genDao("Bean"));
    }

    public static String genDao(String name) {
        return TPL_DAO.replaceAll("\\$\\{name}", name);
    }

    private static final String TPL_DAO = "" +
            "\n" +
            "import com.ruoyi.web.core.mybatis.anno.*;\n" +
            "import com.ruoyi.web.core.mybatis.driver.*;\n" +
            "import org.apache.ibatis.annotations.*;\n" +
            "\n" +
            "import java.util.List;\n" +
            "\n" +
            "public interface ${name}Dao {\n" +
            "\n" +
            "    @Insert(\"\")\n" +
            "    @Lang(SimpleInsertDriver.class)\n" +
            "    void insert(${name} data);\n" +
            "\n" +
            "    @Select(\"\")\n" +
            "    @Lang(SimpleSelectDriver.class)\n" +
            "    List<${name}> selectList(${name} param);\n" +
            "\n" +
            "    @Select(\"\")\n" +
            "    @Lang(SimpleUniqueDriver.class)\n" +
            "    ${name} selectUnique(${name} param);\n" +
            "\n" +
            "    @Update(\"\")\n" +
            "    @Lang(SimpleUpdateDriver.class)\n" +
            "    void update(${name} data);\n" +
            "\n" +
            "    @Delete(\"\")\n" +
            "    @Lang(SimpleDeleteDriver.class)\n" +
            "    void delete(${name} param);\n" +
            "}";
}
